// src/entities/service-edge.entity.ts
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne } from 'typeorm';
import { ServiceNode } from './service-node.entity';

@Entity('service_edges')
export class ServiceEdge {
  @PrimaryGeneratedColumn()
  id: number;

  @ManyToOne(() => ServiceNode, (node) => node.outgoingEdges)
  source: ServiceNode;

  @ManyToOne(() => ServiceNode, (node) => node.incomingEdges)
  target: ServiceNode;

  @Column({ type: 'int', default: 0 })
  qps: number;

  @Column({ type: 'decimal', precision: 6, scale: 2, default: 0 })
  avgResponseTime: number;
}
